package com.example.loginmybatis.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

/**
 * Copyright © 2021 @author yxiao
 * 上海华泉信息科技有限公司
 * https://021hqit.com
 * All rights reserved.
 *
 * @description 基础类，所有实体类都将继承此类
 */
@Data
@MappedSuperclass
@JsonIgnoreProperties(ignoreUnknown = true)
public class BaseResource {

    @Id
    @GeneratedValue(generator = "IdOrGenerated")
    @GenericGenerator(name = "IdOrGenerated", strategy = "com.hp.cstoremanagement.utils.UseIdOrGenerate")
    private String id;

    /**
     * 创建时间
     */
    private Long createdTime = System.currentTimeMillis();

    /**
     * 创建人
     */
    private String creator;

    /**
     * 最近一次更新时间
     */
    @JSONField(name = "lastModifiedTime")
    private Long lastUpdateTime = System.currentTimeMillis();

    /**
     * 最近一次更新操作人
     */
    private String lastUpdater;

    /**
     * 是否被移除
     */
    @JsonIgnore
    @JSONField(name = "deleted")
    private Boolean isRemoved = false;
}
